﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;

namespace com.core.controls
{
    //syntax: res::[Key]
    public interface IDisplayTextControl
    {
        string Text { get; set; }
    }
    public static class TextResourceController
    {
        public static string CurrentLanguage
        {
            get
            {
                return HttpContext.Current.Session["CurrentLanguage"].ToString();
            }
            set
            {
                HttpContext.Current.Session["CurrentLanguage"] = value;
            }
        }
        public static void LoadText(this IDisplayTextControl ctrl)
        {
            if (ctrl.Text.StartsWith("res::"))
            {
                ctrl.Text = LoadTextFromCached(ctrl.Text.Replace("res::", ""));
            }
        }
        static string LoadTextFromCached(string key)
        {
            //more code here
            return "";
        }
    }
}
